package demo.practice.competition;

public class P1000082 {

    public static void main(String[] args) {
        P1000082 p1000082= new P1000082();
        p1000082.leastMinutes(10);
    }

    public int leastMinutes(int n) {

        //假设花了x分钟来设计宽带
        //速度  会达到
        /*int x=5;
        int speed= 1<<x;
        int time= n%speed==0? x+ n/speed: x+ n/speed+1;*/

        int min = n;
        int speed = 1;
        int x = 0;
        while (speed < n && x< min) {
            speed = 1 << x;
            int time = n % speed == 0 ? x + n / speed : x + n / speed + 1;
            min = Math.min(min, time);
            x++;
        }
        System.out.println(--x);

        return min;
    }
}
